package com.threeidiots.transport.entities;

import java.io.Serializable;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.OneToOne;
import javax.persistence.Table;

/**
 * @author Munish Gogna
 * 
 */

@Entity
@Table(name = "PROJECTS")
public class Projects implements Serializable {

	private static final long serialVersionUID = 1L;

	@Id
	@GeneratedValue(strategy = GenerationType.AUTO)
	@Column(name="PROJECT_ID")
	private Long projectId;

	@Column(name="PROJECT_CODE" , nullable = false, length=50)
	private String projectCode;
	
	@Column(name="PROJECT_NAME" , nullable = false, length=50)
	private String projectName;
	
	@OneToOne(targetEntity=com.threeidiots.transport.entities.Employee.class)
	private Employee manager;
	
	@Column(name="PROJECT_DOMAIN" , nullable = true, length=50)
	private String projectDomain;
	
	@Column(name="CCN" , nullable=true)
	private String costCenterNumber;
	

	/**
	 * @return the projectId
	 */
	public Long getProjectId() {
		return projectId;
	}

	/**
	 * @param projectId the projectId to set
	 */
	public void setProjectId(Long projectId) {
		this.projectId = projectId;
	}

	/**
	 * @return the projectCode
	 */
	public String getProjectCode() {
		return projectCode;
	}

	/**
	 * @param projectCode the projectCode to set
	 */
	public void setProjectCode(String projectCode) {
		this.projectCode = projectCode;
	}

	/**
	 * @return the projectName
	 */
	public String getProjectName() {
		return projectName;
	}

	/**
	 * @param projectName the projectName to set
	 */
	public void setProjectName(String projectName) {
		this.projectName = projectName;
	}

	/**
	 * @return the manager
	 */
	public Employee getManager() {
		return manager;
	}

	/**
	 * @param manager the manager to set
	 */
	public void setManager(Employee manager) {
		this.manager = manager;
	}

	/**
	 * @return the projectDomain
	 */
	public String getProjectDomain() {
		return projectDomain;
	}

	/**
	 * @param projectDomain the projectDomain to set
	 */
	public void setProjectDomain(String projectDomain) {
		this.projectDomain = projectDomain;
	}

	/**
	 * @return the costCenterNumber
	 */
	public String getCostCenterNumber() {
		return costCenterNumber;
	}

	/**
	 * @param costCenterNumber the costCenterNumber to set
	 */
	public void setCostCenterNumber(String costCenterNumber) {
		this.costCenterNumber = costCenterNumber;
	}


	/* (non-Javadoc)
	 * @see java.lang.Object#toString()
	 */
	@Override
	public String toString() {
		return "Projects [projectCode=" + projectCode + ", projectId="
				+ projectId + ", projectName=" + projectName + "]";
	}

	/* (non-Javadoc)
	 * @see java.lang.Object#hashCode()
	 */
	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result
				+ ((projectCode == null) ? 0 : projectCode.hashCode());
		result = prime * result
				+ ((projectName == null) ? 0 : projectName.hashCode());
		return result;
	}

	/* (non-Javadoc)
	 * @see java.lang.Object#equals(java.lang.Object)
	 */
	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (!(obj instanceof Projects))
			return false;
		Projects other = (Projects) obj;
		if (projectCode == null) {
			if (other.projectCode != null)
				return false;
		} else if (!projectCode.equals(other.projectCode))
			return false;
		if (projectName == null) {
			if (other.projectName != null)
				return false;
		} else if (!projectName.equals(other.projectName))
			return false;
		return true;
	}
	
	
	

	 
}
